package com.yin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /*
         拦截器配置
        */
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //实现了视图解析器ViewControllers接口，就可以将其看作视图解析器
        registry.addViewController("/").setViewName("dashboard");
        registry.addViewController("/dashboard.html").setViewName("dashboard");
    }
}
